import {defineStore} from 'pinia'
import {useWindowSize} from "@vueuse/core";
import { useFps } from '@vueuse/core'
import {useMouse} from "@vueuse/core/index";
import { useDevicePixelRatio } from '@vueuse/core'

export const useSysStore = defineStore('sys', () => {
    // 像素比
    const { pixelRatio } = useDevicePixelRatio()

    //  当前帧率
    const fps = useFps()
    // 是否折叠了
    const isFolded = ref(false)
    // 当前屏幕的宽度
    const {width, height} = useWindowSize()
    // 宽度小于786的为定义手机
    const isPhone = computed(() => width.value <= 786)
    // 弹出框的个数,同一时间只允许弹出一个
    const messageBoxNum = ref(0)
    // 当前鼠标的x和y坐标
    const {x, y} = useMouse()

    return {pixelRatio,isFolded, width,height,isPhone,messageBoxNum,fps,x,y}
})
